<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
	
			<button id="btn1" onclick="test1()">测试1-打开窗口</button>
			<button id="btn2" onclick="test2()">测试2-关闭窗口</button>
			<button id="btn3" onclick="test3()">测试3-关闭自己</button>
			
			<script>
				var p;
				function test1()
				{
					var w = screen.width;
					var h = screen.height;
					var x = (w-200)/2;
					var y = (h-100)/2;
					// window.open("练习3.html","new","");
					// window.open("练习3.html","new","width=200,height=100");
					// window.open("练习3.html","new","width=200,height=100,top=300,left=200");
					p = window.open("练习3.html","new","width=200,height=100,top="+y+",left="+x);
				}
				
				function test2()
				{
					p.close()
				}
				
				function test3()
				{
					window.close();
					// this.close();
				}
				
			</script>

	</body>
	
	
</html>
